/**
 * Definition de l'etat des classes SharedObject et ServerObject.
 */
public class EtatLock {
	// no local lock
	public static final int NL = 0;
	// read lock cached
	public static final int RLC = 1;
	// write lock cached
	public static final int WLC = 2;
	// read lock taken
	public static final int RLT = 3;
	// write lock taken
	public static final int WLT = 4;
	// read lock taken and write lock cached
	public static final int RLT_WLC = 5;
	// L'etat de la classe ServerObject
	public static final int RL = 6;
	// L'etat de la classe ServerObject
	public static final int WL = 7;

	/**
	 * à partir de l'équivalent à l'état de lock on renvoit la chaine de
	 * caracteres correspondante
	 * 
	 * @author Amandine
	 * @param lock
	 *            the lock we are going to change from int type to String type.
	 * @return the transfered String.
	 */
	public static final String intToString(int lock) {
		String s = "";
		switch (lock) {
		case EtatLock.NL:
			s = "NL";
			break;
		case EtatLock.RLC:
			s = "RLC";
			break;
		case EtatLock.RLT:
			s = "RLT";
			break;
		case EtatLock.WLC:
			s = "WLC";
			break;
		case EtatLock.WLT:
			s = "WLT";
			break;
		case EtatLock.RLT_WLC:
			s = "RLT_WLC";
			break;
		case EtatLock.RL:
			s = "RL";
			break;
		case EtatLock.WL:
			s = "WL";
			break;
		}
		return s;
	}
}
